package com.zhuzi.controller;

import cn.hutool.core.lang.Snowflake;
import cn.hutool.core.util.IdUtil;
import com.zhuzi.utils.ClientUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

/**
 * @author zhuzi
 * 2022/9/14 10:39
 */
@Slf4j
@RestController
@RequestMapping("send")
public class SendController {
    String url = "http://192.168.141.14:8182/Service/parseXml?wsdl";
    private Snowflake snowflake = IdUtil.getSnowflake(1, 2);

    @GetMapping("/three")
    public String three() {

        String str = "<?xml version='1.0' encoding='UTF-8'?><GATHER_INFO><I_E_FLAG>I</I_E_FLAG><AREA_ID>CNCEK070127</AREA_ID><CHNL_NO>CNCEK070127WI06</CHNL_NO><GETHER_MODE></GETHER_MODE><SESSION_ID>CNCEK070127WI0620220914103316</SESSION_ID><IC_INFO><IC_ID></IC_ID><IC_NO>E2801105200078D58FAF0AC0</IC_NO><IC_TYPE></IC_TYPE><IC_EXTENDED_CONTENT></IC_EXTENDED_CONTENT></IC_INFO><FORM_INFO><FORM_TYPE></FORM_TYPE><FORM_ID></FORM_ID></FORM_INFO><DR_CUSTOMS_NO></DR_CUSTOMS_NO><VE_CUSTOMS_NO></VE_CUSTOMS_NO><VE_LICENSE_NO></VE_LICENSE_NO><CONTA_ID></CONTA_ID><ESEAL_ID></ESEAL_ID><GROSS_WT>50</GROSS_WT><VE_RFID><RFID_ID></RFID_ID><VE_LICENSE_NO></VE_LICENSE_NO><VE_CUSTOMS_NO></VE_CUSTOMS_NO><VE_WT></VE_WT><VE_COMPANY></VE_COMPANY><VE_PERFORMANCE></VE_PERFORMANCE></VE_RFID><DR_RFID><RFID_ID></RFID_ID><DR_NAME></DR_NAME><DR_CUSTOMS_NO></DR_CUSTOMS_NO><DR_COMPANY></DR_COMPANY><DR_PERFORMANCE></DR_PERFORMANCE></DR_RFID><PHOTO><PHOTO_GUID></PHOTO_GUID><PHOTO_PERSPECTIVE></PHOTO_PERSPECTIVE></PHOTO><OPERATOR_ID></OPERATOR_ID><OPERATE_TIME>2022/09/14 10:33:16</OPERATE_TIME><EXTEND><NAME></NAME><VALUE></VALUE></EXTEND><CONTA_RECOGNITION><CONTA_ID></CONTA_ID><CONTA_TYPE></CONTA_TYPE><CONTA_LOCK></CONTA_LOCK><CONFIDENCE_RATIO></CONFIDENCE_RATIO></CONTA_RECOGNITION><VE_LICENSE_RECOGNITION><DOMESTIC_LICENSE_NO></DOMESTIC_LICENSE_NO><DOMESTIC_LICENSE_COLOR></DOMESTIC_LICENSE_COLOR><FOREIGN_LICENSE_COLOR></FOREIGN_LICENSE_COLOR><CONFIDENCE_RATIO></CONFIDENCE_RATIO></VE_LICENSE_RECOGNITION></GATHER_INFO>";
        str = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><GATHER_INFO><I_E_FLAG>E</I_E_FLAG><AREA_ID>CNCEK070127</AREA_ID><CHNL_NO>CNCEK070127WI06</CHNL_NO><GETHER_MODE>A</GETHER_MODE><SESSION_ID>CNCEK070127WI06" +
                LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS")) +
                "</SESSION_ID><IC_INFO><IC_ID></IC_ID><IC_NO>E28011052000795A2F8A097F</IC_NO><IC_TYPE></IC_TYPE><IC_EXTENDED_CONTENT></IC_EXTENDED_CONTENT></IC_INFO><FORM_INFO><FORM_TYPE></FORM_TYPE><FORM_ID></FORM_ID></FORM_INFO><VE_LICENSE_NO></VE_LICENSE_NO><CONTA_ID></CONTA_ID><ESEAL_ID></ESEAL_ID><GROSS_WT>1323</GROSS_WT><VE_RFID><RFID_ID>201907220001</RFID_ID><VE_LICENSE_NO></VE_LICENSE_NO><VE_CUSTOMS_NO></VE_CUSTOMS_NO><VE_COMPANY></VE_COMPANY><VE_PERFORMANCE></VE_PERFORMANCE></VE_RFID><DR_RFID><RFID_ID></RFID_ID><DR_NAME></DR_NAME><DR_CUSTOMS_NO></DR_CUSTOMS_NO><DR_COMPANY></DR_COMPANY><DR_PERFORMANCE></DR_PERFORMANCE></DR_RFID><PHOTO><PHOTO_GUID>20190709175226-MT01-05-0.jpg</PHOTO_GUID><PHOTO_PERSPECTIVE>0x30</PHOTO_PERSPECTIVE></PHOTO><OPERATOR_ID>0707</OPERATOR_ID><OPERATE_TIME>2019-11-18 13:52:03</OPERATE_TIME><EXTEND><NAME></NAME><VALUE></VALUE></EXTEND><CONTA_RECOGNITION><CONTA_ID></CONTA_ID><CONTA_TYPE></CONTA_TYPE><CONTA_LOCK></CONTA_LOCK><CONFIDENCE_RATIO></CONFIDENCE_RATIO></CONTA_RECOGNITION><CONTA_RECOGNITION><CONTA_ID></CONTA_ID><CONTA_TYPE></CONTA_TYPE><CONTA_LOCK></CONTA_LOCK><CONFIDENCE_RATIO></CONFIDENCE_RATIO></CONTA_RECOGNITION><VE_LICENSE_RECOGNITION><DOMESTIC_LICENSE_NO></DOMESTIC_LICENSE_NO><DOMESTIC_LICENSE_COLOR></DOMESTIC_LICENSE_COLOR><FOREIGN_LICENSE_NO></FOREIGN_LICENSE_NO><FOREIGN_LICENSE_COLOR></FOREIGN_LICENSE_COLOR><CONFIDENCE_RATIO></CONFIDENCE_RATIO></VE_LICENSE_RECOGNITION></GATHER_INFO>";
        //clientWebservice.invoke("parseSecondTierXml", new Object[] { para1, "0x81" });
        System.out.println(str);
        String parseXml = null;
        try {
            parseXml = ClientUtil.callWebSV(url, "parseSecondTierXml", str, "0x81");
        } catch (Exception e) {
            e.printStackTrace();
        }
        return parseXml;
    }

    @GetMapping("/tow")
    public String tow() {

        String str = "<?xml version='1.0' encoding='UTF-8'?><GATHER_INFO><I_E_FLAG>I</I_E_FLAG><AREA_ID>CNCEK070127</AREA_ID><CHNL_NO>CNCEK070127WI06</CHNL_NO><GETHER_MODE></GETHER_MODE><SESSION_ID>CNCEK070127WI0620220914103316</SESSION_ID><IC_INFO><IC_ID></IC_ID><IC_NO>E2801105200078D58FAF0AC0</IC_NO><IC_TYPE></IC_TYPE><IC_EXTENDED_CONTENT></IC_EXTENDED_CONTENT></IC_INFO><FORM_INFO><FORM_TYPE></FORM_TYPE><FORM_ID></FORM_ID></FORM_INFO><DR_CUSTOMS_NO></DR_CUSTOMS_NO><VE_CUSTOMS_NO></VE_CUSTOMS_NO><VE_LICENSE_NO></VE_LICENSE_NO><CONTA_ID></CONTA_ID><ESEAL_ID></ESEAL_ID><GROSS_WT>50</GROSS_WT><VE_RFID><RFID_ID></RFID_ID><VE_LICENSE_NO></VE_LICENSE_NO><VE_CUSTOMS_NO></VE_CUSTOMS_NO><VE_WT></VE_WT><VE_COMPANY></VE_COMPANY><VE_PERFORMANCE></VE_PERFORMANCE></VE_RFID><DR_RFID><RFID_ID></RFID_ID><DR_NAME></DR_NAME><DR_CUSTOMS_NO></DR_CUSTOMS_NO><DR_COMPANY></DR_COMPANY><DR_PERFORMANCE></DR_PERFORMANCE></DR_RFID><PHOTO><PHOTO_GUID></PHOTO_GUID><PHOTO_PERSPECTIVE></PHOTO_PERSPECTIVE></PHOTO><OPERATOR_ID></OPERATOR_ID><OPERATE_TIME>2022/09/14 10:33:16</OPERATE_TIME><EXTEND><NAME></NAME><VALUE></VALUE></EXTEND><CONTA_RECOGNITION><CONTA_ID></CONTA_ID><CONTA_TYPE></CONTA_TYPE><CONTA_LOCK></CONTA_LOCK><CONFIDENCE_RATIO></CONFIDENCE_RATIO></CONTA_RECOGNITION><VE_LICENSE_RECOGNITION><DOMESTIC_LICENSE_NO></DOMESTIC_LICENSE_NO><DOMESTIC_LICENSE_COLOR></DOMESTIC_LICENSE_COLOR><FOREIGN_LICENSE_COLOR></FOREIGN_LICENSE_COLOR><CONFIDENCE_RATIO></CONFIDENCE_RATIO></VE_LICENSE_RECOGNITION></GATHER_INFO>";
        str = "<?xml version='1.0' encoding='UTF-8'?><GATHER_INFO><I_E_FLAG>E</I_E_FLAG><AREA_ID>CNCEK070127</AREA_ID><CHNL_NO>CNCEK070127WI06</CHNL_NO><GETHER_MODE>A</GETHER_MODE><SESSION_ID>CNCEK070127WI06" +
                LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS")) +
                "</SESSION_ID><IC_INFO><IC_ID></IC_ID><IC_NO>E28011052000795A2F8A097F</IC_NO><IC_TYPE><I/C_TYPE><IC_EXTENDED_CONTENT></IC_EXTENDED_CONTENT></IC_INFO><FORM_INFO><FORM_TYPE></FORM_TYPE><FORM_ID></FORM_ID></FORM_INFO><VE_LICENSE_NO></VE_LICENSE_NO><CONTA_ID></CONTA_ID><ESEAL_ID></ESEAL_ID><GROSS_WT>1323</GROSS_WT><VE_RFID><RFID_ID>201907220001</RFID_ID><VE_LICENSE_NO></VE_LICENSE_NO><VE_CUSTOMS_NO></VE_CUSTOMS_NO><VE_COMPANY></VE_COMPANY><VE_PERFORMANCE></VE_PERFORMANCE></VE_RFID><DR_RFID><RFID_ID></RFID_ID><DR_NAME></DR_NAME><DR_CUSTOMS_NO></DR_CUSTOMS_NO><DR_COMPANY></DR_COMPANY><DR_PERFORMANCE></DR_PERFORMANCE></DR_RFID><PHOTO><PHOTO_GUID>20190709175226-MT01-05-0.jpg</PHOTO_GUID><PHOTO_PERSPECTIVE>0x30</PHOTO_PERSPECTIVE></PHOTO><OPERATOR_ID>0707</OPERATOR_ID><OPERATE_TIME>2019-11-18 13:52:03</OPERATE_TIME><EXTEND><NAME></NAME><VALUE></VALUE></EXTEND><CONTA_RECOGNITION><CONTA_ID></CONTA_ID><CONTA_TYPE></CONTA_TYPE><CONTA_LOCK></CONTA_LOCK><CONFIDENCE_RATIO></CONFIDENCE_RATIO></CONTA_RECOGNITION><CONTA_RECOGNITION><CONTA_ID></CONTA_ID><CONTA_TYPE></CONTA_TYPE><CONTA_LOCK></CONTA_LOCK><CONFIDENCE_RATIO></CONFIDENCE_RATIO></CONTA_RECOGNITION><VE_LICENSE_RECOGNITION><DOMESTIC_LICENSE_NO></DOMESTIC_LICENSE_NO><DOMESTIC_LICENSE_COLOR></DOMESTIC_LICENSE_COLOR><FOREIGN_LICENSE_NO></FOREIGN_LICENSE_NO><FOREIGN_LICENSE_COLOR></FOREIGN_LICENSE_COLOR><CONFIDENCE_RATIO></CONFIDENCE_RATIO></VE_LICENSE_RECOGNITION></GATHER_INFO>";
        //clientWebservice.invoke("parseSecondTierXml", new Object[] { para1, "0x81" });
        System.out.println(str);
        String parseXml = null;
        try {
            parseXml = ClientUtil.callWebSV(url, "parseSecondTierXml", str, "0x81");
        } catch (Exception e) {
            e.printStackTrace();
        }
        return parseXml;
    }

    @GetMapping("/one")
    public String one() {
        String str = "<?xml version='1.0' encoding='UTF-8'?><GATHER_INFO><I_E_FLAG>I</I_E_FLAG><AREA_ID>CNCEK070127</AREA_ID><CHNL_NO>CNCEK070127WI06</CHNL_NO><GETHER_MODE></GETHER_MODE><SESSION_ID>CNCEK070127WI06" +
                LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS")) +
                "</SESSION_ID><IC_INFO><IC_ID></IC_ID><IC_NO></IC_NO><IC_TYPE></IC_TYPE><IC_EXTENDED_CONTENT></IC_EXTENDED_CONTENT></IC_INFO><FORM_INFO><FORM_TYPE></FORM_TYPE><FORM_ID></FORM_ID></FORM_INFO><VE_LICENSE_NO></VE_LICENSE_NO><CONTA_ID></CONTA_ID><ESEAL_ID></ESEAL_ID><GROSS_WT>123</GROSS_WT><VE_RFID><RFID_ID>201907220001</RFID_ID><VE_LICENSE_NO></VE_LICENSE_NO><VE_CUSTOMS_NO></VE_CUSTOMS_NO><VE_COMPANY></VE_COMPANY><VE_PERFORMANCE></VE_PERFORMANCE></VE_RFID><DR_RFID><RFID_ID></RFID_ID><DR_NAME></DR_NAME><DR_CUSTOMS_NO></DR_CUSTOMS_NO><DR_COMPANY></DR_COMPANY><DR_PERFORMANCE></DR_PERFORMANCE></DR_RFID><PHOTO><PHOTO_GUID></PHOTO_GUID><PHOTO_PERSPECTIVE></PHOTO_PERSPECTIVE></PHOTO><OPERATOR_ID></OPERATOR_ID><OPERATE_TIME>2022-09-15 11:45:33</OPERATE_TIME><EXTEND><NAME></NAME><VALUE></VALUE></EXTEND><CONTA_RECOGNITION><CONTA_ID></CONTA_ID><CONTA_TYPE></CONTA_TYPE><CONTA_LOCK></CONTA_LOCK><CONFIDENCE_RATIO></CONFIDENCE_RATIO></CONTA_RECOGNITION><VE_LICENSE_RECOGNITION><DOMESTIC_LICENSE_NO></DOMESTIC_LICENSE_NO><DOMESTIC_LICENSE_COLOR></DOMESTIC_LICENSE_COLOR><FOREIGN_LICENSE_NO></FOREIGN_LICENSE_NO><FOREIGN_LICENSE_COLOR></FOREIGN_LICENSE_COLOR><CONFIDENCE_RATIO></CONFIDENCE_RATIO></VE_LICENSE_RECOGNITION></GATHER_INFO>";
        System.out.println(str);
        String parseXml = null;
        try {
            parseXml = ClientUtil.callWebSV(url, "parseSecondTierXml", str, "0x81");
        } catch (Exception e) {
            e.printStackTrace();
        }
        return parseXml;
    }


}
